﻿#region Copyright
// Partial Copyright (c) LogoUI Software Solutions LTD
// Author: Vladislav Spivak
// This source file is the part of LogoFX Framework http://logofx.codeplex.com
// See accompanying licences and credits.
#endregion



#if !WinRT
using System.Windows;
using System.Windows.Controls;
using System.Windows.Controls.Primitives;
using System.Windows.Data;
using System.Windows.Markup;
using System.Windows.Media;
using System.Windows.Interactivity;
using LogoFX.Core;
using EventTrigger = System.Windows.Interactivity.EventTrigger;
#else
using LogoFX.Core;
using Windows.UI.Interactivity;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Controls.Primitives;
using Windows.UI.Xaml.Data;
using Windows.UI.Xaml.Markup;
using Windows.UI.Xaml.Media;
using EventTrigger = Windows.UI.Interactivity.EventTrigger;
#endif

namespace LogoFX.Infra.Interactivity
{
    [TypeConstraintAttribute(typeof(DependencyObject))]
    public class TargetedSetFocusAction
#if SILVERLIGHT || WinRT
        : TargetedTriggerAction<Control>
#else
        : TargetedTriggerAction<UIElement>
#endif
    {
        protected override void Invoke(object parameter)
        {
            if (Target != null) Target.Focus
                (
#if WinRT
                FocusState.Programmatic
#endif
                );
        }
    }
}
